package com.wangyadong.hobby.thread;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Semaphore;
import java.util.stream.IntStream;

public class SemaphoresTest {

    static final Semaphore semaphore = new Semaphore(2, true);
    private static volatile List<String> list = new ArrayList<>();

    public static void main(String[] args) {
        IntStream.range(0, 20).forEach(i -> {

        });


    }


    public static void put(String str) throws InterruptedException {

        semaphore.acquire();
        list.add(str);


    }

    public static void get(String str) {

    }
}
